blob: a90d17033508f0879f68b4ae421dc6638cc70c16 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
import styles from "./read.module.css";
import Image from "next/image";
export default async function Read({ params }) {
const chapterId = params.read;
const data = await getPages(chapterId);
if (data.length === 0) {
return (
<div className={styles.NotFound}>
<p>
This chapter has no content. Please check the next chapter.
</p>
</div>
);
}
let images = [];
for (var i = 0; i < data.length; i++) {
var imgUrl = data[i].img;
images.push(imgUrl);
}
return (
<div className={styles.Main}>
<div className={styles.ImageContainer}>
{images &&
images.map((item, index) => (
<div className={styles.Image}>
<Image
src={`https://image-proxy-manga.vercel.app/image-proxy?url=${item}`}
key={index}
alt="Pages"
width={800}
height={1000}
priority
/>
<p>{index + 1}</p>
</div>
))}
</div>
</div>
);
}
async function getPages(id) {
const res = await fetch(
`https://consumet-api-di2e.onrender.com/meta/anilist-manga/read?chapterId=${id}&provider=mangadex`
);
const data = await res.json();
return data;
}
|